/**
 * Created by PhpStorm.
 * User:  iyahe@qq.com (天明)
 * Date: 2019/7/31 0031
 * Time: 下午 19:44
 * Description:
 */
import React from 'react';
import {Route} from 'react-router-dom';
import {Menu} from 'element-react';
import '../static/index/index.less'
import HomeDaili from './home/daili'
import HomeYali from './home/yali'
import HomeUser from './home/user'
import jsonHome from './home/json'
export default class Index extends React.Component {
	constructor(props) {
		super(props)
		this.state = {
			currMenu: 1
		}
	}
	render() {
		return (
			<div className="index">
				<Menu theme="dark" defaultActive="1" className="el-menu-demo" mode="horizontal"
							onSelect={this.onSelect.bind(this)}>
					<Menu.Item index="1">代理IP</Menu.Item>
					<Menu.Item index="3">压力测试</Menu.Item>
					<Menu.Item index="4">Excel转Json</Menu.Item>
					<Menu.Item index="2">我的工作台</Menu.Item>
				</Menu>
				<Route path="/daili" component={ HomeDaili }/>
				<Route path="/yali" component={ HomeYali }/>
				<Route path="/user" component={ HomeUser }/>
				<Route path="/json" component={ jsonHome }/>
			</div>
		)
	}
	onSelect(id) {
		let urls = {
			1: '/daili',
			2: '/user',
			3: '/yali',
			4: '/json',
		}
		this.props.history.push(urls[id])
	}
	componentWillMount() {
		const {history} = this.props;
		history.replace("/daili");
	}
}
